package net.huashitong.supervision.task.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.task.dao.CollectDao;
import net.huashitong.supervision.task.entity.CollectEntity;
import net.huashitong.supervision.task.filter.CollectFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/12/25
 * Time: 17:54
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class CollectService extends StringPKService<CollectEntity> {
    @Autowired
    private CollectDao collectDao;
    @Override
    protected BaseDao<CollectEntity, String> getDao() {
        return collectDao;
    }
@Autowired
private SysTableService tableService;
    @Override
    protected void beforeSave(CollectEntity obj) {
        obj.setSysId(tableService.updateMaxSysId("t_task_collect", null));
    }

    public List<CollectEntity> getByUserIdAndType(CollectFilter filter) {
        return collectDao.getByUserIdAndType(filter);
    }

    public List<CollectEntity> getByUserIdAndTaskId(String userId, String sysId,String del) {
        return collectDao.getByUserIdAndTaskId(userId,sysId,del);
    }
}
